home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / master / Examples / Led / led.c next >
C/C++ Source or Header  |  1994-02-01  |  617b  |  40 lines

  1.  
  2. /*
  3.  *  Simple program to flash the LED
  4.  *
  5.  */
  6.  
  7. #include <exec/types.h>
  8. #include <exec/tasks.h>
  9. #include <dos/dos.h>
  10. #include <clib/exec_protos.h>
  11. #include <clib/dos_protos.h>
  12.  
  13. main(ac, av)
  14. int ac;
  15. char *av[];
  16. {
  17.     struct Task *task = FindTask(NULL);
  18.     short n = 500;
  19.  
  20.     /*
  21.      *    actual loop
  22.      */
  23.  
  24.     puts("\nWatch the Power LED and Press ^C to quit!\n");
  25.  
  26.     while ((task->tc_SigRecvd & SIGBREAKF_CTRL_C) == 0) {
  27.     short i;
  28.     short j;
  29.  
  30.     for (i = 0; i < n; ++i) {
  31.         for (j = 0; j < i; ++j)
  32.         *(char *)0xBFE001 |= 0x02;
  33.         for (j = i; j < n; ++j)
  34.         *(char *)0xBFE001 &= ~0x02;
  35.     }
  36.     }
  37.     return(0);
  38. }
  39.  
  40.